$.fn.myBoxy = function (popup, options) {
    myoptions = jQuery.extend ({
        title: "Thông báo",
        message: "",
        type: "alert", 
        refresh: false,
        modal: true,
        callback: function(){}
    }, options);
	
    var content =	'<div id="popup" class="boxy-content" style="width: 400px; margin: 0pt auto; display: block;">'+
    '<div class="title-popup">' + myoptions.title;
    if(myoptions.refresh==true)
    {	
    	content		+= '<a class="btn-close close" onclick="Boxy.get(this).hide();location.reload();"><img src="'+imgurl+'/icon_close.jpg" alt="123mua" /></a>';
    }
    else
    {
    	content		+= '<a class="btn-close close" onclick="Boxy.get(this).hide();"><img src="'+imgurl+'/icon_close.jpg" alt="123mua" /></a>';
    }
    content		+='</div>'+
    '<div class="content-popup" style="position:relative;width:380px">';
    
    if(myoptions.type=='alert')
    {
        content += '<p class="alert-pp">'+myoptions.message+'</p>';
    }
    else if(myoptions.type=='success')
    {
        content += '<p class="alert-pp success-pp">'+myoptions.message+'</p>';
    }
    else if(myoptions.type=='confirm')
    {
        content += '<p class="alert-pp comfirm-pp">'+myoptions.message+'</p>';
    }
    else if(myoptions.type=='message' || myoptions.type=='loading')
    {
        content += '<p align="center">'+myoptions.message+'</p>';
    }
					
    content += 	'</div>';
	

    if(myoptions.type=='alert' || myoptions.type=='success' || myoptions.type=='message')
    {
        content +=	'<div class="footer-popup">';
	    if(myoptions.refresh==true)
	    {	
	    	content		+= '<input id="accept" class="btn-cancel close" type="button" onclick="Boxy.get(this).hide();location.reload();" value="Đóng" style="margin-left:165px;" />';
	    }
	    else
	    {
	    	content		+= '<input id="accept" class="btn-cancel close" type="button" onclick="Boxy.get(this).hide();" value="Đóng" style="margin-left:165px;" />';
	    }
	    content += '</div>';
    }
    else if(myoptions.type=='confirm')
    {
        content +=  '<div class="footer-popup">' +
        '<input id="accept" class="btn-accept" type="button" value="Đồng ý" style="margin-left:115px;" />'+
        '<input id="reject" class="btn-cancel close" onclick="Boxy.get(this).hide();" type="button" value="Bỏ qua" style="margin-left:10px;" />'+
        '</div>';
    }
    else if(myoptions.type=='loading')
    {
    	content +=  '<div class="footer"></div>';
    }
    
    content += '</div>';
    new popup(content, myoptions);

    if(myoptions.type=='confirm')
    {
        $("#accept").click(myoptions.callback);
        $("#accept").click(function(){
            $("#accept, #reject").hide();
            $('<div align="center"><img src='+imgurl+'"/zoomloader.gif" /></div>').insertAfter("#popup footer-popup");
        });
    }
        
    return false;
};